package com.example.es.service;

import com.example.es.entity.MyEntity;
import com.example.es.repository.MyEntityRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyEntityService {

    @Autowired
    private MyEntityRepository repository;

    public MyEntity save(MyEntity entity) {
        return repository.save(entity);
    }

    public List<MyEntity> findByName(String name) {
        return repository.findByName(name);
    }

    public Iterable<MyEntity> findAll() {
        return repository.findAll();
    }

    public void deleteById(String id) {
        repository.deleteById(id);
    }
}
